﻿#region File and License Information
/*
<File>
	<License>
		Copyright © 2009 - 2017, Daniel Vaughan. All rights reserved.
		This file is part of Calcium (http://calciumsdk.net), 
		which is released under the MIT License.
		See file /Documentation/License.txt for details.
	</License>
	<CreationDate>2009-10-14 16:34:20Z</CreationDate>
</File>
*/
#endregion

using System;

namespace Outcoder.InversionOfControl
{
	/// <summary>
	/// Allows setting of type to type, or type to instance associations
	/// in the service container.
	/// </summary>
	public interface IDependencyRegistrar
	{
		bool IsTypeRegistered(Type type, string key = null);
#if USE_DEPRECATED_DEPENDCY_API
		[Obsolete]
		void RegisterInstance<TService>(TService service);
		[Obsolete]
		void RegisterInstance(Type serviceType, object service);
		[Obsolete]
		void RegisterType<TFrom, TTo>() where TTo : TFrom;
		[Obsolete]
		void RegisterSingleton<TFrom, TTo>() where TTo : TFrom;
		[Obsolete]
		void RegisterSingleton(Type fromType, Type toType);
#else
		void Register<TFrom, TTo>(bool singleton = false, string key = null) where TTo : TFrom;
		void Register(Type fromType, Type toType, bool singleton = false, string key = null);
		void Register<TFrom>(TFrom instance, string key = null);
		void Register(Type type, object instance, string key = null);
		void Register<T>(Func<T> getInstanceFunc, bool singleton = false, string key = null);
		void Register(Type type, Func<object> getInstanceFunc, bool singleton = false, string key = null);
#endif
	}
}
